#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>


void GetChild(int signo)
{
  printf("get a signal: %d, pid: %d\n",signo,getpid());
}

int main()
{
  signal(SIGCHLD,GetChild);
  pid_t id = fork();
  if(id==0)
  {
    int cnt=5;
    while(cnt)
    {
      printf("child: %d\n",getpid());
      sleep(1);
      cnt--;
    }
    exit(0);
  }
  while(1);
  return 0;
}
